package com.qidian.mes.md.controller;

import com.qidian.mes.md.service.MdToolService;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: CoolPro
 * @Description:
 * @Time: 2024-04-11 14:32
 **/
@RestController
@RequestMapping("/tool")
@CrossOrigin
public class MdToolController {
    @Autowired
    MdToolService mdToolService;

    @GetMapping("/get")
    public QdResult getMdToolByName(@RequestParam String toolName) {
        return mdToolService.getMdToolsByName(toolName);
    }


    //根据工作站ID获取该工作站下的设备列表
    @GetMapping("/work/get")
    public QdResult getMdToolByWorkId(@RequestParam Integer workId) {
        return mdToolService.getMdToolsByWorkId(workId);
    }

    //批量插入工具
    @PostMapping("/add")
    public QdResult insertWorkTools(@RequestBody Integer[] tools, @RequestParam Integer workId) {
        return mdToolService.insertWorkTools(tools, workId);
    }
}
